flamingo.me/flamingo-commerce/v3@v3.11.0/docs/1. Introduction/4. Testing Conventions.md (about)

     1  # Flamingo Commerce Testing Conventions
     2  
     3  ## Unit Tests
     4  
     5  Go like the unit test are next to the unit they are testing `*_test.go`
     6  
     7  Unit Test should be useful, understandable and maintainable.
     8  
     9  * essential for domain layer and infrastructure layer
    10  * where useful for application and interface layer
    11  
    12  ### Test smells
    13  * Mocking the hell: If you see that most of your testcode is mocking dependencies there is something wrong with the test approach or the design
    14  * Table testing complex logic is often not useful - instead create small individual subtests.
    15   
    16  
    17  ## Integration Tests
    18  
    19  This repository contains a folder `test/integrationtest` with integrationtests. Integration tests boot up a Flamingo application (or parts of it) and let you run blackbox tests.
    20  We differentiate:
    21  
    22  * module tests: Where modules are tested standalone: This makes sure that each module:
    23      * has its dependencies defined well (and don't have too much dependencies)
    24      * is runnable by default (making sure the FakeAdapters work)
    25      * This kind of test are essential useful to **test controller logic** (they are often easier to read and provide more value than mocked controller unit tests)
    26  
    27  * project test: Boots up a complete commerce application - making sure that the integration between the modules work.
    28  
    29  All this test still do not depend on any external system (because they are supposed to use the FakeAdapters)
    30  
    31  ## Contract Testing
    32  
    33  ### Pact Test
    34  Use consumer based contract testing with Pact for Adapters that communicate with external (rest) APIs